﻿using System;
using System.Data;
using System.Configuration;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.ComponentModel;
using TA.JSON;
using TA.Turbo;

namespace TA.Turbo
{
	/// <summary>
	/// Summary description for BaseInclude
	/// </summary>
	public abstract class BaseInclude : IJsonSerializable
	{
		#region PUBLIC
		#region INIT
		/// <summary>
		/// Ctor.
		/// </summary>
		public BaseInclude()
		{
			//
			// TODO: Add constructor logic here
			//
			this.Optimize = true;
			this.Combine = true;
		}
		#endregion
		#region PROPS
		/// <summary>
		/// If true, this script will be combined with others for round-trip number reduction.
		/// </summary>
		[DefaultValue(true)]
		public bool Combine { get; set; }
		/// <summary>
		/// If true, this script will be size optimized.
		/// </summary>
		[DefaultValue(true)]
		public bool Optimize { get; set; }
		/// <summary>
		/// When implemented, gets the content of the include.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		[Browsable(false)]
		public abstract string Content { get; }
		/// <summary>
		/// When implemented, gets the file name of the include.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		[Browsable(false)]
		public abstract string FileName { get; }
		[Browsable(false)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public abstract IncludeType IncludeType { get; }
		#endregion
		#region METHODS
		public abstract string GetClientUrl();
		#endregion
		#region JSON
		[Browsable(false)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public bool IsDirty
		{
			get { return true; }
		}
		public void Serialize(JsonWriter jw)
		{
			this.SerializeObject(jw);
		}
		public virtual void SerializeContents(JsonWriter jw)
		{
			jw.PropertyName("T");
			jw.Value(this.IncludeType);

			jw.PropertyName("S");
			jw.Value(this.GetClientUrl());
		}

		#endregion
		#endregion
		#region INTERNAL
		#region VARS
		#endregion
		#region METHODS
		#endregion
		#endregion

	}
}